// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   register_intrmanufacture_details_again_ok.java

package intrmanufacture.intrmanufacture;

import include.nseer_cookie.exchange;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;
import validata.ValidataNumber;

public class register_intrmanufacture_details_again_ok extends HttpServlet
{

	ServletContext application;
	HttpSession session;

	public register_intrmanufacture_details_again_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			HttpSession session = request.getSession();
			PrintWriter out = response.getWriter();
			nseer_db_backup1 intrmanufacture_db = new nseer_db_backup1(dbApplication);
			if (intrmanufacture_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				ValidataNumber validata = new ValidataNumber();
				String intrmanufacture_ID = request.getParameter("intrmanufacture_ID");
				String demand_gather_shipFee_sum2 = request.getParameter("demand_gather_shipFee_sum");
				String demand_price2 = request.getParameter("demand_price");
				String demand_amount = request.getParameter("demand_amount");
				if (demand_gather_shipFee_sum2.equals(""))
					demand_gather_shipFee_sum2 = "0";
				int n = 0;
				if (!validata.validata(demand_price2) || !validata.validata(demand_amount))
					n++;
				if (n == 0)
				{
					String details_number = request.getParameter("details_number");
					String provider_ID = request.getParameter("provider_ID");
					String provider_name = request.getParameter("provider_name");
					String designer = request.getParameter("designer");
					String contact_person = request.getParameter("contact_person");
					String provider_tel = request.getParameter("provider_tel");
					String provider_fax = request.getParameter("provider_fax");
					String demand_gather_time = request.getParameter("demand_gather_time");
					String demand_gather_type = request.getParameter("demand_gather_type");
					String demand_gather_shipFee_type = request.getParameter("demand_gather_shipFee_type");
					StringTokenizer tokenTO1 = new StringTokenizer(demand_gather_shipFee_sum2, ",");
					String demand_gather_shipFee_sum;
					String demand_gather_shipFee_sum1;
					for (demand_gather_shipFee_sum = ""; tokenTO1.hasMoreTokens(); demand_gather_shipFee_sum = (new StringBuilder(String.valueOf(demand_gather_shipFee_sum))).append(demand_gather_shipFee_sum1).toString())
						demand_gather_shipFee_sum1 = tokenTO1.nextToken();

					String demand_pay_time = request.getParameter("demand_pay_time");
					String demand_pay_type = request.getParameter("demand_pay_type");
					String demand_pay_method = request.getParameter("demand_pay_method");
					String demand_invoice_type = request.getParameter("demand_invoice_type");
					String amount = request.getParameter("amount");
					StringTokenizer tokenTO2 = new StringTokenizer(demand_price2, ",");
					String demand_price;
					String demand_price1;
					for (demand_price = ""; tokenTO2.hasMoreTokens(); demand_price = (new StringBuilder(String.valueOf(demand_price))).append(demand_price1).toString())
						demand_price1 = tokenTO2.nextToken();

					double demand_cost_price_sum = Double.parseDouble(demand_price) * Double.parseDouble(demand_amount);
					String credit_period = request.getParameter("credit_period");
					String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
					String remark = exchange.toHtml(bodyc);
					if (Double.parseDouble(demand_amount) <= Double.parseDouble(amount) || Double.parseDouble(demand_amount) >= Double.parseDouble(amount))
					{
						try
						{
							String sql = (new StringBuilder("update intrmanufacture_details set designer='")).append(designer).append("',demand_contact_person='").append(contact_person).append("',demand_contact_person_tel='").append(provider_tel).append("',demand_gather_time='").append(demand_gather_time).append("',demand_gather_type='").append(demand_gather_type).append("',demand_gather_shipFee_type='").append(demand_gather_shipFee_type).append("',demand_gather_shipFee_sum='").append(demand_gather_shipFee_sum).append("',demand_pay_time='").append(demand_pay_time).append("',demand_pay_type='").append(demand_pay_type).append("',demand_pay_method='").append(demand_pay_method).append("',demand_invoice_type='").append(demand_invoice_type).append("',demand_amount='").append(demand_amount).append("',demand_price='").append(demand_price).append("',demand_cost_price_sum='").append(demand_cost_price_sum).append("',credit_period='").append(credit_period).append("',remark='").append(remark).append("',check_tag='0' where intrmanufacture_ID='").append(intrmanufacture_ID).append("' and provider_ID='").append(provider_ID).append("'").toString();
							intrmanufacture_db.executeUpdate(sql);
							intrmanufacture_db.close();
							response.sendRedirect((new StringBuilder("register_choose_attachment.jsp?provider_ID=")).append(provider_ID).append("&&intrmanufacture_ID=").append(intrmanufacture_ID).toString());
						}
						catch (Exception ex)
						{
							out.println((new StringBuilder("error")).append(ex).toString());
						}
						response.sendRedirect((new StringBuilder("intrmanufacture/intrmanufacture/register_intrmanufacture_details_again_ok_a.jsp?intrmanufacture_ID=")).append(intrmanufacture_ID).toString());
					} else
					{
						response.sendRedirect((new StringBuilder("intrmanufacture/intrmanufacture/register_intrmanufacture_details_again_ok_b.jsp?intrmanufacture_ID=")).append(intrmanufacture_ID).toString());
					}
				} else
				{
					response.sendRedirect((new StringBuilder("intrmanufacture/intrmanufacture/register_intrmanufacture_details_again_ok_c.jsp?intrmanufacture_ID=")).append(intrmanufacture_ID).toString());
				}
				intrmanufacture_db.commit();
				intrmanufacture_db.close();
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception exception) { }
	}
}
